<template>
	<view class="mainBg h100 container">
		<navbar title="" />
		<image class="icon" src="/static/img1.png" mode=""></image>
		<view class="title">
			更新密码
		</view>
		<view class="form">
			<view class="col">
				<image src="@/static/login/form-icon1.png" mode=""></image>
				<input type="tel" placeholder="请输入手机号" v-model="form.phone" />
			</view>
			<view class="col">
				<image src="@/static/login/form-icon2.png" mode=""></image>
				<input type="text" placeholder="请输入验证码" v-model="form.code" />
				<sendCode />
			</view>
			<view class="col">
				<image src="@/static/login/form-icon2.png" mode=""></image>
				<input type="tel" placeholder="请输入新密码" v-model="form.newpwd" />
			</view>
			<view class="col">
				<image src="@/static/login/form-icon2.png" mode=""></image>
				<input type="tel" placeholder="请再次输入新密码" v-model="form.cfmpwd" />
			</view>
		</view>
		<view class="submit" @click="save">
			确认
		</view>
	</view>
</template>

<script>
	import sendCode from '@/components/sendCode.vue'
	export default {
		components: {
			sendCode
		},
		data() {

			return {
				form: {
					phone:'',
					code:'',
					newpwd:'',
					cfmpwd:''
				}
			}
		},
		methods: {
			save() {
				uni.showLoading()
				this.$post("/user/updatePassword", this.form).then(res => {
					uni.hideLoading()
					this.$toast(res.msg)
					if (res.code == 200) {
						setTimeout(() => {
							uni.navigateBack()
						}, 500)
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	page {
		background-color: #35CBAD;
	}

	.icon {
		width: 104rpx;
		height: 104rpx;
		display: block;
		margin: 0 auto;
	}

	.title {
		text-align: center;
		font-weight: bold;
		color: #fff;
		font-size: 56rpx;
		margin: 100rpx 0;
	}

	.form {
		background-color: #fff;
		border-radius: 20rpx;
		padding: 0 40rpx;
		margin-top: 50rpx;

		.col {
			display: flex;
			align-items: center;
			padding: 40rpx 0;
			border-bottom: 1px solid #eee;
			position: relative;

			image {
				width: 36rpx;
				height: 36rpx;
			}

			input {
				font-size: 28rpx;
				padding: 0 20rpx;
			}
		}
	}

	.submit {
		background: linear-gradient(180deg, rgba(130, 234, 154, 1) 0%, rgba(81, 199, 108, 1) 100%);
		text-align: center;
		border-radius: 100px;
		color: #fff;
		line-height: 82rpx;
		font-size: 32rpx;
		margin-top: 80rpx;
	}
</style>